package com.coocaa.ops.admin.v1.auth.sys.mapper;

import com.coocaa.ops.common.core.base.mapper.IBaseMapper;
import com.coocaa.ops.common.core.biz.auth.entity.SysUserRoleEntity;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @author bijiahao
 * @date : 2019/3/18.
 * @description
 */
public interface ISysUserRoleMapper extends IBaseMapper<SysUserRoleEntity> {

    /**
     * 通过用户ID 删除记录
     *
     * @param userId
     */
    void deleteByUserId(Integer userId);

    /**
     * 通过角色ID列表批量删除
     *
     * @param roleIds
     */
    void deleteBatchByRoleIds(@Param("roleIds") Integer[] roleIds);

    /**
     * 批量保存
     *
     * @param entities
     * @return
     */
    Integer addBatch(List<SysUserRoleEntity> entities);

    /**
     * 查询用户对应的角色IDS
     *
     * @param userId
     * @return
     */
    List<Integer> listRoleIdByUserId(Integer userId);
}
